#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string>
#include <iostream>
#include <unistd.h>
using namespace std;
// 进程B 从管道当中读 并且打印到标准输出
int main()
{

    int fd = open("./testfifo", O_RDONLY);
    if (fd < 0)
    {
        perror("open");
    }

    cout << "ProcessA open file done" << endl;

    char buffer[1024] = {0};
    int x = read(fd, buffer, sizeof(buffer));
    if (x > 0)
    {
        buffer[x] = 0;
        cout << "ProcessA say# " << buffer << endl;
    }

    close(fd);

    return 0;
}
